#include "randomwid.h"

randomWid::randomWid(QString onIcon, QString offIcon, bool randomIsActivated)
{
         onPix = new QPixmap(QString(QApplication::applicationDirPath() + "/themes" + onIcon));
         offPix = new QPixmap(QString(QApplication::applicationDirPath() + "/themes" + offIcon));

        this->updateStatus(randomIsActivated);
        qDebug() << "Random status => " << randomIsActivated;
}

void randomWid::mousePressEvent(QGraphicsSceneMouseEvent * event)
{
    qDebug() << "randomToggled()";
    emit this->randomToggled();
}

void randomWid::updateStatus(bool status)
{
    qDebug() << "random => updateStatus => " << status;
    if(status == true){
        this->setPixmap(*onPix);
    }else{
        this->setPixmap(*offPix);
    }
}
